import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MobilityVO, MobilityForm, MobilityQuery } from '@/api/general/humanresources/mobility/resign/types';

/**
 * 查询员工离职申请审批列表
 * @param query
 * @returns {*}
 */

export const listMobility = (query?: MobilityQuery): AxiosPromise<MobilityVO[]> => {
  return request({
    url: '/humanresource/hrEmployeeResignApply/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询员工离职申请审批详细
 * @param id
 */
export const getMobility = (id: string | number): AxiosPromise<MobilityVO> => {
  return request({
    url: '/humanresource/hrEmployeeResignApply/' + id,
    method: 'get'
  });
};

/**
 * 新增员工离职申请审批
 * @param data
 */
export const addMobility = (data: MobilityForm) => {
  return request({
    url: '/humanresource/hrEmployeeResignApply',
    method: 'post',
    data: data
  });
};

/**
 * 修改员工离职申请审批
 * @param data
 */
export const updateMobility = (data: MobilityForm) => {
  return request({
    url: '/humanresource/hrEmployeeResignApply',
    method: 'put',
    data: data
  });
};

/**
 * 删除员工离职申请审批
 * @param id
 */
export const delMobility = (id: string | number | Array<string | number>) => {
  return request({
    url: '/humanresource/hrEmployeeResignApply/' + id,
    method: 'delete'
  });
};
